﻿namespace NopSolutions.NopCommerce.Controls
{
    /// <summary>
    /// Classe de auxílio para criação de input do tipo radio
    /// </summary>
    internal class HtmlInputRadio
    {
        /// <summary>
        /// Valor do input
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// Título do input
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// Indica se o input está selecionado
        /// </summary>
        public bool Checked { get; set; }

        public HtmlInputRadio() {

        }

        public HtmlInputRadio(string value, string title, bool selected) {
            this.Value = value;
            this.Title = title;
            this.Checked = selected;
        }

        /// <summary>
        /// Retorna o Html do input
        /// </summary>
        /// <returns></returns>
        public string GetHtml() {
            return string.Format("<input type=\"radio\" name=\"newrate\" value=\"{0}\" title=\"{1}\" {2} />",
                this.Value, this.Title, this.Checked ? "checked=\"true\"" : string.Empty);
        }

        public override string ToString() {
            return this.GetHtml();
        }
    }
}
